<template>
	<!-- <el-dialog :title="titleMap[mode]" v-model="visible" :width="1200" destroy-on-close @closed="$emit('closed')" lock-scroll="false"> -->
	<el-container class="el-container">
    <el-card shadow="never" :header="$t('user_data.userDetail')" style="margin-top: 20px;width: 100%;">
			<el-descriptions border :column="3">
				<el-descriptions-item label="user_name">绑定的内容</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
			</el-descriptions>
			<el-descriptions border :column="3">
				<el-descriptions-item label="user_name">绑定的内容</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
			</el-descriptions>
			<el-descriptions border :column="1">
				<el-descriptions-item label="user_name">绑定的内容</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
			</el-descriptions>
			<el-descriptions border :column="3">
				<el-descriptions-item label="user_name">绑定的内容</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
			</el-descriptions>
			<el-descriptions border :column="1">
				<el-descriptions-item label="user_name">绑定的内容</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
				<el-descriptions-item label="placeholder">占位符</el-descriptions-item>
				<el-descriptions-item label="height">编辑器高度，默认300</el-descriptions-item>
			</el-descriptions>
		</el-card>
	<!-- </el-dialog> -->
	</el-container>
</template>

<script>
	export default {
		emits: ['success', 'closed'],
		data() {
			return {
				mode: "add",
				titleMap: {
					add: this.$t('table_data.adduserTitle'),
					edit: this.$t('table_data.userTitle')
				},
				locationArr: [{
          value: 'ja',
          label: 'Japanese'
        }, {
          value: 'en',
          label: 'English'
        }, {
          value: 'chs',
          label: '中文简体'
        }, {
          value: 'cht',
          label: '中文繁體'
        }],
				form: {
					head: "",
					background: "",
					location: "",
					fullName:"",
					userType: "",
					userName: "",
					email: "",
					phoneNo: "",
					status: "",
					sex: 0,
					desc: '',
					twitter: '',
					instagram: '',
					facebook: '',
				},
				rules: {
					appId:[
						{required: true, message: '请输入应用标识'}
					],
					appName:[
						{required: true, message: '请输入应用名称'}
					],
					secret:[
						{required: true, message: '请输入秘钥'}
					],
					type:[
						{required: true, message: '请选择类型范围', trigger: 'change'}
					],
					exp:[
						{required: true, message: '请选择授权到期日期', trigger: 'change'}
					]
				},
				visible: false,
				isSaveing: false
			}
		},
		methods: {
			//显示
			open(mode='add'){
				this.mode = mode;
				this.visible = true;
				return this;
			},
			//表单提交方法
			submit(){
				this.$refs.dialogForm.validate(async (valid) => {
					if (valid) {
						this.isSaveing = true;
						var res = await this.$API.demo.post.post(this.form);
						this.isSaveing = false;
						if(res.code == 200){
							this.$emit('success', this.form, this.mode)
							this.visible = false;
							this.$message.success("操作成功")
						}else{
							this.$alert(res.message, "提示", {type: 'error'})
						}
					}
				})
			},
			//表单注入数据
			setData(data){
				this.form.id = data.id
				this.form.appId = data.appId
				this.form.appName = data.appName
				this.form.secret = data.secret
				this.form.type = data.type
				this.form.exp = data.exp
			}
		}
	}
</script>

<style scoped>
.el-container {
  margin: 12px;
  border: 1px solid #CCCCCC;
  padding: 20px;
  background: #fff;
  border-radius: 4px;
}
.el-descriptions__label,.el-descriptions__cell,.is-bordered-label {
  width: 150px !important;
}
</style>
